@extends('front.common.header_bg')

@section('title','企业中心')

@section('content')
@include('front.common.editor')
<link href="{{ asset('/css/employ/list.css') }}" rel="stylesheet" type="text/css">
<script src="{{ asset('/js/metisMenu/dist/metisMenu.min.js') }}"></script>
<script type="text/javascript" src="{{asset('/js/swfupload/swfupload.js')}}"></script>
<script type="text/javascript" src="{{asset('/js/swfupload/swfupload.swfobject.js')}}"></script>
<script type="text/javascript" src="{{asset('/js/swfupload/swfupload.queue.js')}}"></script>
<script type="text/javascript" src="{{asset('/js/swfupload/fileprogress.js')}}"></script>
<script type="text/javascript" src="{{asset('/js/swfupload/handlers.js')}}"></script>
<script type="text/javascript" src="{{asset('/js/swfupload/swfupload.speed.js')}}"></script>
<script type="text/javascript" src="{{asset('/js/company.js')}}"></script>
<script type="text/javascript">
var swfu;
SWFUpload.onload = function () {
	var settings = {
		flash_url : "{{asset('/js/swfupload/swfupload.swf')}}",
		upload_url: "{{url('/upload/teaches')}}",
		file_types : "*.zip;*.mp4;*.xls;*.xlsx;*doc;*.docx;*.pdf",//文件类型
		file_types_description : "视频文件",//文件类型描述
		file_upload_limit : 1,//一次性上传文件数量
		file_queue_limit : 1,//一次性选择队列上传文件数量
		file_size_limit : "50 MB",//除了php.ini里面的设置外，这里也要设置
		Filedata:'file',
		post_params:{
			'_token':"{{csrf_token()}}",
			'app':'teaches_company'
		},
		button_disabled:false,
		use_query_string:false,
		custom_settings : {
		
		tdCurrentSpeed : document.getElementById("tdCurrentSpeed"),
		tdTimeRemaining : document.getElementById("tdTimeRemaining"),
		tdTimeElapsed : document.getElementById("tdTimeElapsed"), 
		tdPercentUploaded : document.getElementById("tdPercentUploaded"), 
		tdSizeUploaded : document.getElementById("tdSizeUploaded"),
		tdProgressEventCount : document.getElementById("tdProgressEventCount"),					
		uploadButtonId : "btnUpload",
		myFileListTarget : "idFileList"

		},
		debug: false,//开启调试
		auto_upload:true,//自动上传

		//按钮设置
		button_image_url : "{{asset('/images/front/upload_btn.jpg')}}",
		button_placeholder_id : "spanButtonPlaceholder",
		button_width: 180,
		button_height: 50,

		//The event handler functions are defined in handlers.js
		swfupload_loaded_handler : swfUploadLoaded,
		file_queued_handler : fileQueued,
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,
		upload_start_handler : uploadStart,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadSuccess,
		upload_complete_handler : uploadComplete,
		queue_complete_handler : queueComplete,	// Queue plugin event

		// SWFObject settings
		minimum_flash_version : "9.0.28",
		swfupload_pre_load_handler : swfUploadPreLoad,
		swfupload_load_failed_handler : swfUploadLoadFailed
	};
	swfu = new SWFUpload(settings);
};
</script>
<div class="main">
    <div class="employ-list clearfix" style="padding-top:30px;">
        <form id="teachesForm">
        <div class="employ-list-left fl" id="step1">
            <div class="employ-search">
                <div class="upload-title clearfix">
                    <a href="{{url('/company/center/document')}}"><i class="icon-angle-left"></i>&nbsp;&nbsp;返回</a>
                    <span class="float-r upload-other-step"><a href="{{url('/company/center/document/create?type=step')}}"><i class="icon-plus"></i>&nbsp;&nbsp;分布教程</a></span>
                </div>
                <div class="teaches-upload-button upload-boder-bottom">
                    <div class="upload_icon">
                        <div id="selectfile"><div class="teaches-upload-btn" id="spanButtonPlaceholder"></div></div>
                        <div class="upload_progress">
                			<div style="clear:both;display:block;">
                				<table id="idFileList" class="uploadFileList" style="table-layout:fixed" width="500">
                				  
                				  <tr class="uploadTitle">
                					<td width="100%" height="0" align="center" style="visibility:hidden;" colspan="2"><b>文件名</b></td>
                				  </tr>
                				  <tr class="uploadTitle">
                					<td width="80%" height="0" align="center" style="visibility:hidden;">状态</td>
                					<td width="20%" height="0" align="center" style="visibility:hidden;">操作</td>
                				  </tr>
                				</table>
                			</div>
                			<div style="clear:both;">
                		        <span>已上传：<span id="tdSizeUploaded" style="margin-left:0px;">0</span></span>
                			    <span>上传速度：<span id="tdCurrentSpeed" style="margin-left:0px;">--KB/s</span></span>
                			    <span>时间：<span id="tdTimeRemaining" style="margin-left:0px;">0</span>/<span id="tdTimeElapsed" style="margin-left:0px;">0</span></span> 
                			    <span>进度：<span id="tdPercentUploaded" style="margin-left:0px;" >0</span></span>
                				<input type='hidden' id='all_pic_str' value='' />
                				<div style="display:none;">等待上传 <span id="idFileListCount">0</span>  个 ，成功上传 <span id="idFileListSuccessUploadCount">0</span> 个</div>
                				<div id="divSWFUploadUI" style="visibility: hidden;"></div>
                			</div>
                		</div>
                        <div class="upload-block">从我的电脑中选择需要上传的文档</div>
                        @if(!empty($result))
                        <div class="has-upload-info">
                            <p>已有相关教程内容，是否需要进行替换，不需要请点击下一步，修改教程其他信息。</p>
                            <div class="next-step" onclick="toNextStep()">下一步</div>
                        </div>                        
                        @endif
                    </div>
                </div>
                <div class="teaches-upload-button">
                    <p class="title">温馨提示</p>
                    <p class="block">上传文档支持word、excel、PDF格式；视频支持MP4；附件支持ZIP</p>
                    <p class="title">共建海量文档，共建文档分享美好体验</p>
                    <p class="block color-000">1、信息安全，品质保证 － 青苜知识仓库拥有稳定可靠的信息安全体系，永久保护个人信息安全，保证文档信息不丢失，杜绝网络信息泄漏隐患</p>
                    <p class="block color-000">2、您可以向千万网友展示自己的精美文档并免费全文阅读其他用户上传的海量文档。</p>
                    <p class="block color-000">3、免费分享优质原创文档，将获得青苜赠予的积分奖励；此外，您也可以通过其他用户下载您的文档获取相应积分。</p>
                    <p class="tips-block">无论您上传何种文档，请您一定遵守文档上传须知哦，快来开启您的美好体验之旅吧。</p>
                </div>
            </div>
        </div>
        
        <div class="employ-list-left fl" id="step2" style="display: none">
            <input type="hidden" name="documentid" id="documentid" value="{{!empty($documentid)?$documentid:0}}">
            <input type="hidden" name="url" id="url">
            <input type="hidden" name="documenttype"  id="documenttype" value="{{!empty($documenttype)?$documenttype:0}}">
            <div class="employ-search">
                <div class="teaches-upload-success-top">
                    <div class="teaches-upload-success-title">
                        <i class="icon-ok-sign color-green"></i>
                        <span class="color-green">1</span>
                        <span class="font-28">篇文档上传完毕！</span>
                        <span class="font-16 color-gray2">填写完文档信息后点击“完成上传”</span>
                    </div>
                    <div class="teaches-upload-success-title2">
                        <div class="success-progress float-l"></div>
                        <div class="font-14 color-gray2 sucess-pg-ti float-l">100%</div>
                        <div class="clearfix"></div>
                    </div>
                </div>
                <div class="teaches-upload-content clearfix">
                    <div class="teaches-form-main float-l boder-right-cc">
                        <div class="form-group clearfix">
                            <div class="col-xs-12 col-sm-3 col-3 ft-16 cor-2">内训名称：</div>
                            <div class="col-sm-9 col-xs-12"> 
                                <input type="text" class="form-control" name="name" placeholder="请输入课程名称" value={{!empty($result)?$result->name:''}}>
                                <div class="help-block" id="error" style="color:red;"></div>
                            </div>
                         </div>
                         
                         <div class="form-group clearfix">
                            <div class="col-xs-12 col-sm-3 col-3 ft-16 cor-2">课程简介：</div>
                            <div class="col-sm-9 col-xs-12"> 
                                <textarea class="form-control content" name="description">{{empty($result)?'':$result->description}}</textarea>
                            </div>
                         </div>
                         <div class="form-group clearfix">
                            <div class="col-xs-12 col-sm-3 col-3 ft-16 cor-2">作者：</div>
                            <div class="col-sm-9 col-xs-12"> 
                                <input name="author" class="form-control" type="text" value="@if(!empty($result)){{ $result->author }}@endif" />
                            </div>
                        </div>
                        <div class="form-group clearfix">
                            <div class="col-xs-12 col-sm-3 col-3 ft-16 cor-2">来源：</div>
                            <div class="col-sm-9 col-xs-12"> 
                                <input name="from" class="form-control" type="text" value="@if(!empty($result)){{ $result->from }}@endif" />
                            </div>
                        </div>
                    </div>
                    <div class="teaches-form-main float-l">
                        <div class="form-group clearfix">
                            <div class="col-xs-12 col-sm-3 col-3 ft-16 cor-2">封面图片：</div>
                            <div class="col-sm-9 col-xs-12"> 
                                <div class="input-group ">
                                	<input type="hidden" name="thumb" id="thumb" value="{{!empty($result)?$result->thumb:0}}">
                                	<input type="text" name="logo" value="{{empty($result)?'':(count($result->attachment)>0 ? $result->attachment->url:'')}}" class="form-control" autocomplete="off">
                                	<span class="input-group-btn">
                                		<button class="btn btn-default" style="height:43px;" type="button" onclick="showImageDialog(this, '{{$opts}}',{{$options}});">选择图片</button>
                                	</span>
                                </div>
                                <div class="input-group " style="margin-top:.5em;margin-left: 0px;">
                    				<img src="{{empty($result)?asset('/images/nopic.jpg'):(count($result->attachment)>0 ? $result->attachment->url:'')}}" onerror="this.src='/images/nopic.jpg'; this.title='图片未找到.'" class="img-responsive img-thumbnail" width="150">
                    				<em class="close" style="position:absolute; top: 0px; right: -18px;" title="删除这张图片" onclick="deleteImage(this)">×</em>
                    			</div>
                            </div>
                         </div>
                        <div class="form-group clearfix">
                            <div class="col-xs-12 col-sm-3 col-3 ft-16 cor-2">标签：</div>
                            <div class="col-sm-9 col-xs-12"> 
                                <div class="tagsinput-primary">
                                    <input name="tagsinput" class="tagsinput" data-role="tagsinput" value="@if(!empty($newstag)){{ $newstag }}@endif" />
                                </div>
                            </div>
                        </div>
                        <div class="form-group clearfix">
                            <div class="col-xs-12 col-sm-3 col-3 ft-16 cor-2">售价：</div>
                            <div class="col-sm-9 col-xs-12"> 
                                <input name="price" class="form-control" type="number" value="@if(!empty($result)){{ $result->price }}@endif" />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="save-button-group clearfix">
                    {!! csrf_field() !!}
                    <input type="hidden" name="teaches_id" value="{{!empty($result)?$result->id:0}}">
                    <div class="form-group float-r">
                      <button type="button" class="btn btn-primary btn-upload-style" onclick="saveData('/company/center/document','teachesForm','')">
                            <i class="icon-ok bigger-110"></i>完成上传
                      </button>  
                    </div>
                </div>
            </div>
        </div>
        </form>
        <div class="employ-list-right fl">
            <div class="employ-list-tips">
                <div class="tips-title font-16">文档上传须知</div>
                <div class="teaches-upload-tips" >
                    <p>1、请勿上传国家法律禁止的内容</p>
                    <p>2、不得上传涉及侵权内容的文档</p>
                    <p>3、请勿上传涉嫌泄密的内容</p>
                    <p>4、请勿上传带有商业广告的文档</p>
                    <p>5、上传文件大小限制在50M以内</p>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
<!--
$('input').iCheck({
	checkboxClass: 'icheckbox_flat-blue',
    radioClass: 'iradio_flat-blue',
    increaseArea: '-10' // optional
});
var editor;
KindEditor.ready(function(K) {
	editor = K.create('.content', {	
    	resizeType : 1,
    	//allowPreviewEmoticons : false,
    	afterBlur: function () { this.sync(); },
    	allowImageUpload : true,
    	width : "100%", 
    	allowUpload : true,
    	//postParams:123,
    	//uploadJson : '/index.php?g=User&m=Upyun&a=kindedtiropic',
    	items : ["justifyleft", "justifycenter", "justifyright", ]
	});

});
//-->
</script>
@stop
